package com.jams.goodox.activity.serve.park;

import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.jams.goodox.BaseActivity;
import com.jams.goodox.R;
import com.jams.goodox.adapter.CustomFragmentPagerAdapter;
import com.jams.goodox.utils.StyleUtil;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;

/**
 * 停车申请记录
 * Created by jams_zhen on 2017/5/24.
 */

public class ParkHistoryActivity extends BaseActivity{
    @Bind(R.id.tabLayout)
    TabLayout tabLayout;
    @Bind(R.id.viewPager)
    ViewPager viewPager;

    private List<Fragment> fragmentList;

    private ParkHistoryFragment meetHistoryFragment1;
    private ParkHistoryFragment meetHistoryFragment2;

    private boolean isPersonPark;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_meet_history;
    }

    @Override
    protected void init() {
        StyleUtil.titleBackKey(this,"申请记录");
        boolean isPersonPark=getIntent().getBooleanExtra("isPersonPark",false);

        meetHistoryFragment1=ParkHistoryFragment.getInstance(true,isPersonPark);
        meetHistoryFragment2=ParkHistoryFragment.getInstance(false,isPersonPark);

        fragmentList = new ArrayList<>();
        List<String> tabsTitle = new ArrayList<>();
        fragmentList.add(meetHistoryFragment1);
        tabsTitle.add("有效订单");
        fragmentList.add(meetHistoryFragment2);
        tabsTitle.add("已过期");

        viewPager.setAdapter(new CustomFragmentPagerAdapter(getSupportFragmentManager(), tabsTitle, fragmentList));

        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setTabMode(TabLayout.MODE_FIXED);
        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
